﻿using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Net;

namespace project_phoenix.source
{
    class PauseMenuScreen : MenuScreen
    {
        NetworkSession networkSession;


        public PauseMenuScreen(NetworkSession session) : base("Pause Screen")
        {
            // load the pause image


            IsPopup = true;

            // Add the Resume Game menu entry.
            MenuEntry resumeGameMenuEntry = new MenuEntry("Resume Game");
            resumeGameMenuEntry.Selected += OnCancel;
            MenuEntries.Add(resumeGameMenuEntry);

            // for now just add quit - this will change for networked games obviously
            MenuEntry quitGameMenuEntry = new MenuEntry("Quit Game");
            quitGameMenuEntry.Selected += QuitGameMenuEntrySelected;
            MenuEntries.Add(quitGameMenuEntry);
        }

        // Quit the game
        void QuitGameMenuEntrySelected(object sender, PlayerIndexEventArgs e)
        {
            MessageBoxScreen confirmQuitMessageBox =
                                    new MessageBoxScreen("Are you sure you want to quit?");

            confirmQuitMessageBox.Accepted += ConfirmQuitMessageBoxAccepted;

            ScreenManager.AddScreen(confirmQuitMessageBox, ControllingPlayer);
        }

        // resume game
        void ConfirmQuitMessageBoxAccepted(object sender, PlayerIndexEventArgs e)
        {
            LoadingScreen.Load(ScreenManager, false, null, new BackgroundScreen(),
                                                           new MainMenuScreen());
        }


        public override void Draw(GameTime gameTime)
        {
            //ScreenManager.FadeBackBufferToBlack(TransitionAlpha * 2 / 3);

            base.Draw(gameTime);
        }
    }
}
